package com.block.datapush.common.factory;

import com.block.common.util.ApplicationContextUtil;
import com.block.datapush.form.item.*;
import com.block.datapush.form.service.IFormPushHandle;

import java.util.HashMap;
import java.util.Map;

public class PushFactory {


    private static Map<String, Class<? extends IFormPushHandle>> serviceMap = new HashMap<>();
    static {
        serviceMap.put("HAPPY", HappyPushHandleService.class);

    }

    public static IFormPushHandle getService(String filterKey){
        if (serviceMap.containsKey(filterKey)){
            Class<? extends IFormPushHandle> aClass = serviceMap.get(filterKey);
            return ApplicationContextUtil.getBean(aClass);
        }
        return null;
    }

}
